package com.ford.trade.repository;

import com.ford.trade.entity.AoKeGame;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author: ford
 * @date: 2022/4/25 11:58
 */
@Repository
public interface AoKeGameRepository extends JpaRepository<AoKeGame, Long> {

    AoKeGame findByIndexId(Long index);

    List<AoKeGame> findAllByDateAfter(String date);

    @Query(value = "SELECT * FROM `trade`.`aoke_game` WHERE `date` BETWEEN ?1 AND ?2 ORDER BY `date`", nativeQuery = true)
    List<AoKeGame> findByDateBetween(String startDate,String endDate);

    List<AoKeGame> findAllByDateAfterAndType(String date, String type);


}
